package models

import "github.com/jinzhu/gorm"

var db *gorm.DB

type GcUser struct {
	id int `gorm:"primary_key" json:"id"`
	account string `json:"account"`
	name string `json:"name"`
	password string `json:"password"`
	age int `json:"age"`
	telphone string `json:"telphone"`
	qq  string `json:"qq"`
	weixin string `json:"weixin"`
	email string `json:"email"`
	sex int `json:"sex"`
}

func AddGcUser(data map[string]interface{}) error {
	gcUser :=GcUser{
		account: data["account"].(string),
		name: data["account"].(string),
		password: data["account"].(string),
		age: data["account"].(int),
		telphone: data["account"].(string),
		qq: data["account"].(string),
		weixin: data["account"].(string),
		email: data["account"].(string),
		sex: data["account"].(int),
	}
	 err :=db.Create(&gcUser).Error
	 if err !=nil{
	 	return err
	 }
	 return nil
}
